]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
unlockDialog: Bind source titles
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 9 May 2024 12:01:26 +0000 (14:01 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 9 May 2024 12:03:34 +0000 (14:03 +0200)
After the recent notification changes, the title may still be null
when the source is originally added. Handle that case and make sure
we pick up later title changes by setting up a property binding.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3308>

js/ui/unlockDialog.js

index 7b2ab8d38df47a28619558cd41843e9836810ebb..f741b20a6fa22d251d70d3da3d96039f660b1ef1 100644 (file)
@@ -96,11 +96,13 @@ const NotificationsBox = GObject.registerClass({
         box.add_child(textBox);
 
         let title = new St.Label({
-            text: source.title,
             style_class: 'unlock-dialog-notification-label',
             x_expand: true,
             x_align: Clutter.ActorAlign.START,
         });
+        source.bind_property('title',
+            title, 'text',
+            GObject.BindingFlags.SYNC_CREATE);
         textBox.add_child(title);
 
         let count = source.unseenCount;
@@ -127,9 +129,13 @@ const NotificationsBox = GObject.registerClass({
         box.add_child(textBox);
 
         let title = new St.Label({
-            text: source.title.replace(/\n/g, ' '),
             style_class: 'unlock-dialog-notification-label',
         });
+        source.bind_property_full('title',
+            title, 'text',
+            GObject.BindingFlags.SYNC_CREATE,
+            (bind, sourceVal) => [true, sourceVal?.replace(/\n/g, ' ') ?? ''],
+            null);
         textBox.add_child(title);
 
         let visible = false;